﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.SimpleFlow
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.SimpleFlow;

    public class map_ApprovalToDoUserRole : EntityMapping<ApprovalToDoUserRole>
    {
        public map_ApprovalToDoUserRole()
        {
            Property(x => x.RoleCode, map =>
            {
                map.Length(20);
            });

            Property(x => x.RoleName, map =>
            {
                map.Length(40);
            });

            //下一步待办角色对应的用户操作列表（多对多）
            Bag(x => x.Users, map =>
            {
                map.Table("ref_ToDoRole_Users");
                map.Key(keyMapper => keyMapper.Column("ToDoRoleId"));
            }, act => act.ManyToMany(m => m.Column("UserId")));
        }

    }
}
